//
//  UCItemCell.m
//  ROSE
//
//  Created by 艾阳 on 2018/5/31.
//  Copyright © 2018年 HeNanZhongDunYunAn. All rights reserved.
//

#import "UCItemCell.h"

@implementation UCItemCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        if (!_icon) {
            _icon = [[UIImageView alloc]init];
            _icon.contentMode = UIViewContentModeScaleToFill;
            //UIViewContentModeScaleAspectFill;
            _icon.backgroundColor = [UIColor yellowColor];
            [self.contentView addSubview:_icon];
        }
        if(!_title){
            _title = [[UILabel alloc]init];
            _title.backgroundColor = [UIColor clearColor];
            _title.textColor = [UIColor lightGrayColor];
            _title.textAlignment = NSTextAlignmentCenter;
            _title.font = [UIFont boldSystemFontOfSize:13];
            _title.text = @"小王子";
            [self.contentView addSubview:_title];
        }
        
        [self makeLayout];
    }
    return self;
}
- (void)makeLayout{
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
        make.top.mas_equalTo(0);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(60);
    }];
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(self.icon.mas_bottom).with.offset(5);
        make.width.mas_equalTo(self.contentView);
        make.height.mas_equalTo(20);
    }];
    
    
    
}

@end
